# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=dpeparser
pkgver=beta002
pkgrel=5
epoch=1
pkgdesc='Default password enumeration project.'
arch=('any')
url='http://www.toolswatch.org/dpe/'
license=('GPL')
groups=('blackarch' 'blackarch-cracker')
depends=('python2')
source=('http://www.toolswatch.org/dpe/dpeparser.py')
sha512sums=('f941a536b7eb05f589dbbc1533d07dbb10a50776f197aca5b5158b263e216603e833ce315f73b1f3d0fe59ea10578dcd1059b998ca1db27c0bd4c8c4239b9f27')

prepare() {
  sed -i 's#MydpeDB ="dpe_db.xml"#MydpeDB = "/usr/share/dpeparser/dpe_db.xml"#'\
    "$pkgname.py"
}

build() {
  python2 "$pkgname.py" -u
}

package() {
  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -m 755 "$pkgname.py" "$pkgdir/usr/share/$pkgname/"
  install -m 644 dpe_db.xml "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
exec python2 /usr/share/$pkgname/$pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

